package com.wyd.qxglht.dao;

import java.util.List;

import javax.transaction.Transactional;

import com.wyd.qxglht.model.UsersRoles;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface IUsersRolesDao extends JpaRepository<UsersRoles, String>, JpaSpecificationExecutor<UsersRoles> {




    //获取指定用户的角色
    
@Query("select u from UsersRoles u where u.userId = :userId")
List<UsersRoles> getRoles(String userId);


    //移除用户角色
    //删除用户
        @Transactional
        @Modifying
        @Query("delete UsersRoles u  where u.userId =:userId and u.roleId =:roleId")
         int delUsersRole(String userId,String roleId);




}